home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / info-service / prospero / mail / prospero.arc / text0003.txt < prev    next >
Encoding:
Text File  |  1993-07-31  |  1.4 KB  |  50 lines

  1. I rather often want to look at a file on a remote system, and either
  2. absorb the information that's in the file with my own eyes or 
  3. send it off to a printer or some other kind of single-use thing.
  4. For these purposes the idiom of
  5.     vget foo
  6.     less foo
  7.     rm foo
  8. is kind of tiresome.
  9.  
  10. FTP is actually reasonable in handling this idiom; if you 
  11. invoke it roughly as follows.  The "-i" flag inhibits all of
  12. the status messages et al, so what you get is the file on
  13. standard out.  so you have "ftpcat host /pub/foo | more"
  14. and you're set.
  15.  
  16. It appears the the "-i" flag's processing has been taken out
  17. of vget.  (I don't have the ftp client sources handy to see
  18. what all it did.)  My first approach to building a "vcat"
  19. is to take ftp.c and ensure that all of the status messages,
  20. "500 command not understood" reports, and the like were sent
  21. to stderr instead of stdout.  then vcat is merely
  22.  
  23. vget $1 - 2>/dev/null
  24.  
  25. (i.e. get rid of stderr) and you can say
  26.  
  27. vcat /archive-sites/dec.com/pub/maps/letter/s-michigan.ps | lpr
  28.  
  29. i.e. get rid of stderr.  It messes up real error messages
  30. though, so if the file really is not found it's not the
  31. right thing to do.
  32.  
  33. Diffs available upon request; they are entirely mechanical,
  34. just finding all printf() and turning into fprintf(stderr),
  35. and all putchar() into putc(c,stderr).  
  36.  
  37. --Ed
  38. Edward Vielmetti
  39. emv@msen.com
  40.  
  41. #!/bin/sh
  42. # ftpcat
  43. # usage: ftpcat host.domain.org /pub/README
  44. #
  45. ftp -i $1 <<EOF
  46. binary
  47. get $2 |cat
  48. EOF
  49.  
  50.